<?php 
$companyid=$session->read("companyid");
$user=$session->read('User');
?>
<div class="right_side_operate_area">
	<div>
		<?php  
			$user=$session->read('User');
			if($showpage==1) {
				if(isset($paging)){ echo $this->renderElement('pagination',$paging);} 
			}
		?>
		
	  	<?php 
	  	if(classregistry::init('User')->personAuthority($user)){
	    		echo '<div class="right item_add_btn">';
	    		if ($slsy){
	    			echo $html->link(__("Add",true),"/companys/editssperson");
	    		}else{
	    			echo $html->link(__("Add",true),"/companys/editperson");
	    		}
				echo '</div>';
	  			
	    		echo '<div class="right item_add_btn">';
				echo $html->link(__("人员数",true),"/companys/showeditpersonnumpage/".$compayid);
				echo '</div>';
	  	}
		?>		
		<div class="right search_box">
			<form onsubmit="return searchinfo()">
		    	<div class="left search_text">
		    		<?php echo $form->text('company.keyword',array('placeholder'=>'搜索人员姓名','value'=>$keyword, 'id'=>'search', 'class'=>'text_box'));?>
		    	</div>
		        <div class="left search_btn"><input type="submit" value=""/></div>
	        </form>
	        <div class="clear"></div>
	    </div>
		<div class="right_side_title left">
			<h2>
			<?php 
			$companyname=$session->read("companyname");
			echo $html->link($companyname,"/companys/showinfosummary/".$companyid);
			?>
			</h2>
			<div class="clear"></div>
		</div>
	    <div class="clear"></div>
	</div>
	<div class="right_sidt_head_screen">
		<div class="right_side_head_line">
			<ul>
<?php 
	if (!empty($persontypes)){
		if (!is_array($persontypes)){//如果数据不为数组，则把它拼为数组
			$persontypes[] = $persontypes;
		}

		foreach ($persontypes as $key=>$value){
			if (!empty($key)){
				$showPNvalue = array();
				if (is_array($personnums)){//至少有两条记录
					foreach ($personnums as $personnum){
						if ($personnum['CompPersonNum']['type_id'] == $key){
							$showPNvalue = $personnum['CompPersonNum'];
						}
					}
				}else{//只有一条记录
					if ($personnums['CompPersonNum']['type_id'] == $key){
						$showPNvalue = $personnums['CompPersonNum'];
					}
				}
?>
				<li>
					<div class="left screen_condition"><?php echo $value;?>：</div>
					<div class="left screen_counts"><?php echo $showPNvalue['number']==''?'0':$showPNvalue['number'];?>人</div>
					<div class="clear"></div>
				</li>
<?php			
			}
		}
	}    		
?>				
			</ul>
		</div>
	</div>
</div>
<div class="clear"></div>
<div class="right_side_scollbar">
    <div class="detail_info_panel">
        <div class="items_list">
        	<table>
            	<tr>
                    <th>姓名</th>
                    <th>毕业院校</th>
                    <th>所学专业</th>
                    <th>最高学历</th>
                    <th>核心团队</th>
<?php 
	if ($slsy){
?>
					<th>保险编号</th>
<?php
	}
?>                    
                    <th><?php __("Action")?></th>
                </tr>
                <?php 
				foreach($persons as $person){
					$id=$person["CompPerson"]["id"];
					$person_name=$person["CompPerson"]["person_name"];
					echo "<tr class='per_list'>";
					if ($slsy){
						echo "<td>".$html->link($person_name,"/companys/showssperson/".$id,null,null)."</td>";
					}else{
						echo "<td>".$html->link($person_name,"/companys/showperson/".$id,null,null)."</td>";
					}
					echo "<td>".$person["CompPerson"]["school"]."</td>";
					echo "<td>".$person["CompPerson"]["major"]."</td>";
					$education=$person["CompPerson"]["education"];
					echo "<td>".$str->geteducation($education)."</td>";
					$is_core=$person["CompPerson"]["is_core"];
					echo "<td>".$str->getisflag($is_core)."</td>";
					if ($slsy){
						echo "<td>".$person["CompPerson"]["socialsecurityID"]."</td>";
					}
					echo "<td>";
					if(classregistry::init('User')->personAuthority($user)&&classregistry::init('Company')->personAuthority($person)){
						if ($slsy){
							echo $html->link(__("Edit",true),"/companys/editssperson/".$id,null,null);
						}else{
							echo $html->link(__("Edit",true),"/companys/editperson/".$id,null,null);
						}
						$email = base64_encode($person["CompPerson"]["email"]);
						echo $html->link(__("Delete",true),"/companys/delperson/".$id."/".$email,array("onclick"=>"return doaction(this)"));
					}	
					echo "</td>";
					echo "</tr>";
				}?>
            </table>
		</div>
    </div>
</div>
<?php echo $this->element('actionconfirm',array("title"=>"删除提示","message"=>"你确定要删除吗？")) ?>

<script>
funPlaceholder(document.getElementById("search"));
</script>